﻿using Android.Text;
using Xamarin.Forms;

namespace Moven.Droid.Renderers
{
	internal static class KeyboardExtensions
	{
		//
		// Static Methods
		//
		public static InputTypes ToInputType(this Keyboard self)
		{
			InputTypes result = InputTypes.DatetimeVariationNormal;
			if (self == Keyboard.Default)
			{
				result = InputTypes.ClassText;
			}
			else if (self == Keyboard.Chat)
			{
				result = (InputTypes.ClassText | InputTypes.TextFlagCapSentences | InputTypes.TextFlagNoSuggestions);
			}
			else if (self == Keyboard.Email)
			{
				result = (InputTypes.ClassText | InputTypes.DatetimeVariationTime);
			}
			else if (self == Keyboard.Numeric)
			{
				result = (InputTypes.ClassNumber | InputTypes.NumberFlagDecimal);
			}
			else if (self == Keyboard.Telephone)
			{
				result = InputTypes.ClassPhone;
			}
			else if (self == Keyboard.Text)
			{
				result = (InputTypes.ClassText | InputTypes.TextFlagCapSentences);
			}
			else if (self == Keyboard.Url)
			{
				result = (InputTypes.ClassText | InputTypes.DatetimeVariationDate);
			}
			else {
				result = InputTypes.DatetimeVariationNormal;
			}
			return result;
		}
	}
}
